/**
 * Created by QKL on 2016/6/15.
 */
var openId="openId";
var weixin_appId="wxf8471ff43eccfa90";
//var weixin_appId="wxaebc7c4041d351ce";

$(function(){
    $('#icon-home').on('click',function(){
    	$(this).attr('href',"forwardPage_index.action");
//    	$(this).attr('href',"forwardPage_shopList.action?parms.tenantId=1468202825174");
    });
    $('#icon-type').on('click',function(){
    	$(this).attr('href',"forwardPage_tempStart.action");
//    	$(this).attr('href',"forwardPage_typeList.action");
    });
    $('#icon-clifford').on('click',function(){
    	$(this).attr('href',"forwardPage_cliffordList.action");
    });
    $('#icon-person').on('click',function(){
    	$(this).attr('href',"forwardPage_userperson.action");
    });
    $('.icon-chevron-left').on('click',function(){
        window.history.back(-1);
    });
    $('.fanhui').on('click',function(){
        window.history.back(-1);
    });
});
function goBack(){
	  window.history.back(-1);
}
function goRefresh(){
	window.location.reload();
}
function noNumbers(e)  
{  
var keynum  
var keychar  
var numcheck  
if(window.event) // IE  
{  
keynum = e.keyCode  
}  
else if(e.which) // Netscape/Firefox/Opera  
{  
keynum = e.which  
}  
keychar = String.fromCharCode(keynum);
//鍒ゆ柇鏄暟瀛�,涓斿皬鏁扮偣鍚庨潰鍙繚鐣欎袱浣嶅皬鏁�
if(!isNaN(keychar)){
var index=e.currentTarget.value.indexOf(".");
if(index >= 0 && e.currentTarget.value.length-index >2){
return false;
}
return true;
}
//濡傛灉鏄皬鏁扮偣 浣嗕笉鑳藉嚭鐜板涓� 涓旂涓�浣嶄笉鑳芥槸灏忔暟鐐�
if("."== keychar ){
if(e.currentTarget.value==""){
return false;
}
if(e.currentTarget.value.indexOf(".") >= 0){
return false;
}
return true;
}
return false  ;
} 
//妫�鏌ユ槸鍚︿负寰俊
function isWeiXin() {
    var ua = window.navigator.userAgent.toLowerCase();
    if (ua.match(/MicroMessenger/i) == 'micromessenger') {
        return true;
    } else {
        return false;
    }
}
function addCookie(objName,objValue,objHours){//娣诲姞cookie
	var str = objName + "=" + escape(objValue);
	if(objHours > 0){//涓�0鏃朵笉璁惧畾杩囨湡鏃堕棿锛屾祻瑙堝櫒鍏抽棴鏃禼ookie鑷姩娑堝け
	var date = new Date();
	var ms = objHours*3600*1000;
	date.setTime(date.getTime() + ms);
	str += "; expires=" + date.toGMTString();
	}
	document.cookie = str;
//	alert("娣诲姞cookie鎴愬姛");
	}
function getCookie(objName){//鑾峰彇鎸囧畾鍚嶇О鐨刢ookie鐨勫��
	var arrStr = document.cookie.split("; ");
	for(var i = 0;i < arrStr.length;i ++){
	var temp = arrStr[i].split("=");
	if(temp[0] == objName) return unescape(temp[1]);
	} 
}
function delCookie(name){//涓轰簡鍒犻櫎鎸囧畾鍚嶇О鐨刢ookie锛屽彲浠ュ皢鍏惰繃鏈熸椂闂磋瀹氫负涓�涓繃鍘荤殑鏃堕棿
	var date = new Date();
	date.setTime(date.getTime() - 10000);
	document.cookie = name + "=a; expires=" + date.toGMTString();
	}
//闄ゆ硶鍑芥暟锛岀敤鏉ュ緱鍒扮簿纭殑闄ゆ硶缁撴灉 
//璇存槑锛歫avascript鐨勯櫎娉曠粨鏋滀細鏈夎宸紝鍦ㄤ袱涓诞鐐规暟鐩搁櫎鐨勬椂鍊欎細姣旇緝鏄庢樉銆傝繖涓嚱鏁拌繑鍥炶緝涓虹簿纭殑闄ゆ硶缁撴灉銆� 
//璋冪敤锛歛ccDiv(arg1,arg2) 
//杩斿洖鍊硷細arg1闄や互arg2鐨勭簿纭粨鏋�

function accDiv(arg1,arg2){ 
var t1=0,t2=0,r1,r2; 
try{t1=arg1.toString().split(".")[1].length}catch(e){} 
try{t2=arg2.toString().split(".")[1].length}catch(e){} 
with(Math){ 
r1=Number(arg1.toString().replace(".","")) 
r2=Number(arg2.toString().replace(".","")) 
return (r1/r2)*pow(10,t2-t1); 
} 
} 
//缁橬umber绫诲瀷澧炲姞涓�涓猟iv鏂规硶锛岃皟鐢ㄨ捣鏉ユ洿鍔犳柟渚裤�� 
Number.prototype.div = function (arg){ 
return accDiv(this, arg); 
} 


//涔樻硶鍑芥暟锛岀敤鏉ュ緱鍒扮簿纭殑涔樻硶缁撴灉 
//璇存槑锛歫avascript鐨勪箻娉曠粨鏋滀細鏈夎宸紝鍦ㄤ袱涓诞鐐规暟鐩镐箻鐨勬椂鍊欎細姣旇緝鏄庢樉銆傝繖涓嚱鏁拌繑鍥炶緝涓虹簿纭殑涔樻硶缁撴灉銆� 
//璋冪敤锛歛ccMul(arg1,arg2) 
//杩斿洖鍊硷細arg1涔樹互arg2鐨勭簿纭粨鏋� 

function accMul(arg1,arg2) 
{ 
var m=0,s1=arg1.toString(),s2=arg2.toString(); 
try{m+=s1.split(".")[1].length}catch(e){} 
try{m+=s2.split(".")[1].length}catch(e){} 
return Number(s1.replace(".",""))*Number(s2.replace(".",""))/Math.pow(10,m) 
} 
//缁橬umber绫诲瀷澧炲姞涓�涓猰ul鏂规硶锛岃皟鐢ㄨ捣鏉ユ洿鍔犳柟渚裤�� 
Number.prototype.mul = function (arg){ 
return accMul(arg, this); 
} 


//鍔犳硶鍑芥暟锛岀敤鏉ュ緱鍒扮簿纭殑鍔犳硶缁撴灉 
//璇存槑锛歫avascript鐨勫姞娉曠粨鏋滀細鏈夎宸紝鍦ㄤ袱涓诞鐐规暟鐩稿姞鐨勬椂鍊欎細姣旇緝鏄庢樉銆傝繖涓嚱鏁拌繑鍥炶緝涓虹簿纭殑鍔犳硶缁撴灉銆� 
//璋冪敤锛歛ccAdd(arg1,arg2) 
//杩斿洖鍊硷細arg1鍔犱笂arg2鐨勭簿纭粨鏋� 

function accAdd(arg1,arg2){ 
var r1,r2,m; 
try{r1=arg1.toString().split(".")[1].length}catch(e){r1=0} 
try{r2=arg2.toString().split(".")[1].length}catch(e){r2=0} 
m=Math.pow(10,Math.max(r1,r2)) 
return (arg1*m+arg2*m)/m 
} 
//缁橬umber绫诲瀷澧炲姞涓�涓猘dd鏂规硶锛岃皟鐢ㄨ捣鏉ユ洿鍔犳柟渚裤�� 
Number.prototype.add = function (arg){ 
return accAdd(arg,this); 
}

//鍦ㄤ綘瑕佺敤鐨勫湴鏂瑰寘鍚繖浜涘嚱鏁帮紝鐒跺悗璋冪敤瀹冩潵璁＄畻灏卞彲浠ヤ簡銆� 
//姣斿浣犺璁＄畻锛�7*0.8 锛屽垯鏀规垚 (7).mul(8) 
//鍏跺畠杩愮畻绫讳技锛屽氨鍙互寰楀埌姣旇緝绮剧‘鐨勭粨鏋溿��



//鍑忔硶鍑芥暟
function Subtr(arg1,arg2){
   var r1,r2,m,n;
   try{r1=arg1.toString().split(".")[1].length}catch(e){r1=0}
   try{r2=arg2.toString().split(".")[1].length}catch(e){r2=0}
   m=Math.pow(10,Math.max(r1,r2));
   //last modify by deeka
   //鍔ㄦ�佹帶鍒剁簿搴﹂暱搴�
   n=(r1>=r2)?r1:r2;
   return ((arg1*m-arg2*m)/m).toFixed(n);
}
Array.prototype.remove = function(s) {   
    for (var i = 0; i < this.length; i++) {   
        if (s == this[i])   
            this.splice(i, 1);   
    }   
}   
  
/**  
 * Simple Map  
 *   
 *   
 * var m = new Map();  
 * m.put('key','value');  
 * ...  
 * var s = "";  
 * m.each(function(key,value,index){  
 *      s += index+":"+ key+"="+value+"/n";  
 * });  
 * alert(s);  
 *   
 * @author dewitt  
 * @date 2008-05-24  
 */  
function Map() {   
    /** 瀛樻斁閿殑鏁扮粍(閬嶅巻鐢ㄥ埌) */  
    this.keys = new Array();   
    /** 瀛樻斁鏁版嵁 */  
    this.data = new Object();   
       
    /**  
     * 鏀惧叆涓�涓敭鍊煎  
     * @param {String} key  
     * @param {Object} value  
     */  
    this.put = function(key, value) {   
        if(this.data[key] == null){   
            this.keys.push(key);   
        }   
        this.data[key] = value;   
    };   
       
    /**  
     * 鑾峰彇鏌愰敭瀵瑰簲鐨勫��  
     * @param {String} key  
     * @return {Object} value  
     */  
    this.get = function(key) {   
        return this.data[key];   
    };   
       
    /**  
     * 鍒犻櫎涓�涓敭鍊煎  
     * @param {String} key  
     */  
    this.remove = function(key) {   
        this.keys.remove(key);   
        this.data[key] = null;   
    };   
       
    /**  
     * 閬嶅巻Map,鎵ц澶勭悊鍑芥暟  
     *   
     * @param {Function} 鍥炶皟鍑芥暟 function(key,value,index){..}  
     */  
    this.each = function(fn){   
        if(typeof fn != 'function'){   
            return;   
        }   
        var len = this.keys.length;   
        for(var i=0;i<len;i++){   
            var k = this.keys[i];   
            fn(k,this.data[k],i);   
        }   
    };   
       
    /**  
     * 鑾峰彇閿�兼暟缁�(绫讳技<a href="http://lib.csdn.net/base/javaee" class='replace_word' title="Java EE鐭ヨ瘑搴�" target='_blank' style='color:#df3434; font-weight:bold;'>Java</a>鐨別ntrySet())  
     * @return 閿�煎璞key,value}鐨勬暟缁�  
     */  
    this.entrys = function() {   
        var len = this.keys.length;   
        var entrys = new Array(len);   
        for (var i = 0; i < len; i++) {   
            entrys[i] = {   
                key : this.keys[i],   
                value : this.data[i]   
            };   
        }   
        return entrys;   
    };   
       
    /**  
     * 鍒ゆ柇Map鏄惁涓虹┖  
     */  
    this.isEmpty = function() {   
        return this.keys.length == 0;   
    };   
       
    /**  
     * 鑾峰彇閿�煎鏁伴噺  
     */  
    this.size = function(){   
        return this.keys.length;   
    };   
       
    /**  
     * 閲嶅啓toString   
     */  
    this.toString = function(){   
        var s = "{";   
        for(var i=0;i<this.keys.length;i++,s+=','){   
            var k = this.keys[i];   
            s += k+"="+this.data[k];   
        }   
        s+="}";   
        return s;   
    };   
}   
//璁＄畻澶╂暟宸殑鍑芥暟锛岄�氱敤  
function  DateDiff(sDate1,  sDate2){    // sDate1鍜宻Date2鏄�2006-12-18鏍煎紡  
    var  aDate,  oDate1,  oDate2,  iDays  ;
    aDate  =  sDate1.split("-")  ;
    oDate1  =  new  Date(aDate[1]  +  '-'  +  aDate[2]  +  '-'  +  aDate[0]);    //杞崲涓�12-18-2006鏍煎紡  
    var timeArray;
    timeArray= sDate2.split(" ");
    aDate  = timeArray[0].split("-")  ;
    oDate2  =  new  Date(aDate[1]  +  '-'  +  aDate[2]  +  '-'  +  aDate[0]) ; 
    iDays  =  parseInt(Math.abs(oDate1  -  oDate2)  /  1000  /  60  /  60  /24) ;   //鎶婄浉宸殑姣鏁拌浆鎹负澶╂暟  
    return  iDays ; 
}
//+---------------------------------------------------  
//| 瀛楃涓茶浆鎴愭棩鏈熺被鍨�   
//| 鏍煎紡 MM/dd/YYYY MM-dd-YYYY YYYY/MM/dd YYYY-MM-dd  
//+---------------------------------------------------  
function StringToDate(DateStr)  
{   

  var converted = Date.parse(DateStr);  
  var myDate = new Date(converted);  
  if (isNaN(myDate))  
  {   
      //var delimCahar = DateStr.indexOf('/')!=-1?'/':'-';  
      var arys= DateStr.split('-');  
      myDate = new Date(arys[0],--arys[1],arys[2]);  
  }  
  return myDate;  
}  
